﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class BodyChange : MonoBehaviour {

    public float duration = 5f;
    public float speedAppend = 2f;

    private void OnTriggerEnter2D(Collider2D collision) {
        var player = collision.GetComponentInParent<CharacterData>();
        if (player == null) {
            return;
        }

        if(!player.isBodyChange) {
            player.BodyChange(speedAppend, duration);
            gameObject.SetActive(false);
        }

    }

}
